Trilium allows importing from OneNote. Currently the only mechanism supported is via the Microsoft Graph API which requires you to authenticate in a browser in order for the notes to be obtained by Trilium.
The following features are preserved by Trilium during the import process:
onenote: link
is kept.Regarding the note structure:
The OneNote importer uses Microsoft's Graph API which handles the HTML export (that we later post-process for Trilium use). The Graph API itself has to process the OneNote pages before sending them to us, and as such it's a time-consuming operation that is directly proportional to the number of notes and the complexity/size of the notes.
The Graph API throttles access if it detects too many operations. The importer takes that into account, but sometimes this means that most of the time is spent waiting for the Graph API to unblock access rather than actually importing data.
In addition, some pages may fail at the Graph API level due to an internal timeout on their side or other issues. Trilium will try to refetch pages in order to avoid that but sometimes pages cannot be retrieved even after multiple retries. In that case, the importer will still create a corresponding note in Trilium but with an error report instead of a content. This preserves Internal (reference) links and makes it easy to identify and manually fix the pages that failed.
At the end of the import, the top-level note called OneNote import will contain information about how the import went:
To avoid cases in which the import is fundamentally broken (e.g. an expired sign-in), the import will error out if it fails to import 6 pages in a row.
Pages imported from OneNote have a few built-in labels:
oneNotePageId, with the corresponding
page ID in OneNote. This can be used to identify the original OneNote page.
Trilium doesn't use it in any way at this moment.oneNoteImportFailed attached to notes that
couldn't be imported. This can be used to quickly Search for failed notes.OneNote is fundamentally different to Trilium in structure because it allows freehand drawing to coexist with text, and text boxes can be placed anywhere in the document (e.g. a common use case is to have columns). Trilium has a document flow mechanism for Text notes which means that it can't be freely positioned.
To cope with this difference, Trilium will flatten the text structure into normal paragraphs. The paragraphs will be ordered visually based on the original position of the text boxes, but their horizontal position will not be preserved. Parallel text such as columns may appear interleaved which can cause problems.
In addition, drawing in OneNote can be interleaved with text boxes. Text notes in Trilium do not allow for this feature, so all drawing will appear at the end. For some use cases (diagrams, for example) this will work fine, but if you have highlights or other text-dependent drawings they will appear out of order.
OneNote supports encryption at section level; when importing a notebook that contains these password-protection sections, Trilium will not be able to read the content of password-protected sections so they will appear empty. This is not a limitation of Trilium, the information is simply not available from the source (Graph API).
The section itself is kept for reference and all the sections that could not be imported will be shown in the report (the top-level note called OneNote import).
To unprotect a section in OneNote Desktop, right click on the protected section → Password Protect This Section and press Remove Password and sync. Then reimport either only the protected sessions or the remove everything and start the import from scratch.
The following are known limitations due to how the information comes from the import (Microsoft Graph API), which means that they cannot be fixed.
When importing notes, you might find that some text is not rendered properly or the structure is not properly maintained. As long as this issue is not a fundamental issue (like the issue with freehand text not being preserved exactly), it's a good idea to report it.
When reporting, make sure that you provide the following information: